import {connect} from 'react-redux'
import Count from '../../components/count'
import {increment,decrement,asyncincrement} from '../../redux/action.js'
const mapState=(state)=>({num:state})

// 完整版写法
const mapDispatch=(dispatch)=>(
	{
		increment:(data)=>{
			dispatch(increment(data))
		},
		decrement:(data)=>{
			dispatch(decrement(data))
		},
		asyncincrement:(data,time)=>{
			dispatch(asyncincrement(data,time))
		}
	}
)

// 简写版写法
const mapDispatch2={
	increment,
	decrement,
	asyncincrement
}
export default connect(mapState,mapDispatch2)(Count)
